package com.ltkj.ticket.controller;

import com.ltkj.common.core.web.controller.BaseController;
import com.ltkj.common.core.web.domain.AjaxResult;
import com.ltkj.common.core.web.page.TableDataInfo;
import com.ltkj.common.log.annotation.Log;
import com.ltkj.common.log.enums.BusinessType;
import com.ltkj.common.security.annotation.RequiresPermissions;
import com.ltkj.ticket.domain.vo.TicVenuesAddVO;
import com.ltkj.ticket.domain.vo.TicVenuesListVO;
import com.ltkj.ticket.service.iTicVenuesBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author gushaoliang
 * @Date 2023/8/30 14:32
 * @PackageName:com.ltkj.ticket.controller
 * @ClassName: TicVenuesBusinessController
 * @Description: 场馆预约业务类
 * @Version 1.0
 */
@Api(tags = "场馆预约业务类")
@RestController
@RequestMapping("/venuesbusiness")
public class TicVenuesBusinessController extends BaseController {

    @Autowired
    private iTicVenuesBusinessService ticVenuesBusinessService;


    /**
     * 查询场馆门票列表
     */
    @ApiOperation("查询场馆门票列表")
    @RequiresPermissions("ticket:venuesbusiness:list")
    @GetMapping("/listVenues")
    public TableDataInfo list(TicVenuesListVO ticVenuesListVO)
    {
        startPage();
        List<TicVenuesListVO> list = ticVenuesBusinessService.list(ticVenuesListVO);
        return getDataTable(list);
    }
    // /**
    //  * 下架Or上架场馆门票
    //  */
    // @ApiOperation("上架场馆门票")
    // @RequiresPermissions("ticket:venues:edit")
    // @Log(title = "上架场馆门票", businessType = BusinessType.ONSHELF)
    // @GetMapping("/{venuesId}")
    // public AjaxResult onVenues(@PathVariable("venuesId") Long venuesId)
    // {
    //     return toAjax(ticVenuesBusinessService.onVenues(venuesId));
    // }



    /**
     * 新增场馆门票西门学哦
     */
    @ApiOperation("新增场馆门票")
    @RequiresPermissions("ticket:venuesbusiness:add")
    @Log(title = "场馆门票", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult addVenuesBusiness(@RequestBody TicVenuesAddVO ticVenuesAddVO)
    {
        return toAjax(ticVenuesBusinessService.addVenuesBusiness(ticVenuesAddVO));
    }
    /**
     * 获取场馆门票详细信息
     */
    @ApiOperation("获取场馆门票详细信息")
    @RequiresPermissions("ticket:venuesbusiness:query")
    @GetMapping(value = "/{ticVenuesConfigId}")
    public AjaxResult getVenuesConfigInfo(@PathVariable("ticVenuesConfigId") Long ticVenuesConfigId)
    {
        return success(ticVenuesBusinessService.getVenuesConfigInfo(ticVenuesConfigId));
    }
    //修改场馆门票详细信息

    /**
     * 修改场馆门票
     */
    @ApiOperation("修改场馆门票详细信息")
    @RequiresPermissions("ticket:venuesbusiness:edit")
    @Log(title = "场馆门票", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult editVenuesConfigInfo(@RequestBody TicVenuesAddVO ticVenuesAddVO)
    {
        return toAjax(ticVenuesBusinessService.editVenuesConfigInfo(ticVenuesAddVO));
    }
}